<template>
  <view class="box">
    <view class="tou top" :style="'padding-top:' + statusBarHeight1 + 'px'">
      <image @click="fanhui" src="https://pic.bangbangtongcheng.com/static/fanhui_bai.png" />详情
    </view>
    <view class="tit">{{ datas.title }}</view>
    <view class="shijian">
      <view>{{ datas.create_date }}</view>
      <view>{{ datas.author }}</view>
    </view>
    <view class="xian"></view>
    <view class="con">
      <!-- <rich-text :nodes="datas.content"></rich-text> -->
	  <!-- #ifdef MP-WEIXIN -->
	  <rich-text :nodes="datas.content"></rich-text>
	  <!-- #endif -->
	  <!-- #ifndef MP-WEIXIN -->
	  <p v-html="datas.content"></p>
	  <!-- #endif -->
    </view>
	<uniBall></uniBall>
  </view>
</template>

<script>
  //#ifdef H5
  import wxshare from "../../utils/index.js";
  //#endif
  import {
    mapGetters
  } from "vuex";
  export default {
    data() {
      return {
        id: "",
        datas: {}
      };
    },
    computed: {
      ...mapGetters(["statusBarHeight1", "userinfo"])
    },
    onLoad(options) {
      this.id = options.id;
      this.getDetail();
      this.ll()
      /* #ifdef H5 */
      this.jinzhi();
      /* #endif */
    },
    methods: {
      fanhui() {
        uni.navigateBack({
          delta: 1
        });
      },
      ll() {
        if (this.userinfo) {
          let that = this;
          this.$myRequest
            .post("/mob/user/saveUserCollection", {
              userId: this.userinfo.id,
              type: "2",
              cbType: "7",
              relationId: this.id
            })
            .then(res => {});
        }
      },
      getDetail() {
        this.$myRequest
          .get("/mob/user/getTalesPromotionDetail", {
            id: this.id
          })
          .then(res => {
            // console.log(res);
            this.datas = res.map;
          });
      },
      jinzhi() {
        let _this = this;
        let param = window.location.href.split("#")[0];
        uni.request({
          method: "post",
          data: {
            url: param
          },
          header: {
            "content-type": "application/x-www-form-urlencoded"
          },
          url: "https://www.bangbangtongcheng.com/conven//mob/login/getJsTicket.do",
          success(re) {
            _this.jinzhifx(re.data);
          }
        });
      },
      jinzhifx(data) {
        wxshare.config({
          debug: false, //是否打开调试
          appId: data.appId, // 公众号的唯一标识
          timestamp: data.timestamp, // 生成签名的时间戳
          nonceStr: data.nonce, // ，生成签名的随机串
          signature: data.signature, // 签名
          jsApiList: ["hideMenuItems"]
        });
        // 禁止分享
        wxshare.hideMenuItems({
          // 要隐藏的菜单项，只能隐藏“传播类”和“保护类”按钮，所有menu项见附录3
          menuList: [
            "menuItem:share:appMessage",
            "menuItem:share:timeline",
            "menuItem:share:timeline",
            "menuItem:share:qq",
            "menuItem:favorite",
            "menuItem:share:QZone",
            "menuItem:openWithSafari"
          ]
        });
      }
    }
  };
</script>

<style lang="less" scoped>
  .box {
    width: 100%;
    min-height: 100vh;
    color: #333;
    background-color: #fff;
  }

  .tou {
    position: relative;
    width: 100%;
    // height: 88rpx;
    text-align: center;
    line-height: 88rpx;
    font-size: 36rpx;
    color: #fff;
    background-color: #64b6a8;

    image {
      position: absolute;
      width: 32rpx;
      height: 32rpx;
      // top: 116rpx;
      left: 30rpx;
    }
  }

  .tit {
    width: 690rpx;
    margin-left: 30rpx;
    margin-top: 40rpx;
    font-size: 34rpx;
    color: #333;
    font-weight: 600;
  }

  .shijian {
    margin-top: 16rpx;
    margin-left: 30rpx;

    view {
      display: inline-block;
      margin-right: 24rpx;
      height: 42rpx;
      line-height: 38rpx;
      font-size: 26rpx;
      color: #666;
    }

    .guan {
      width: 82rpx;
      height: 40rpx;
      border: 1rpx solid #64b6a8;
      text-align: center;
      font-size: 24rpx;
      border-radius: 22rpx;
      color: #64b6a8;
    }
  }

  .xian {
    width: 690rpx;
    height: 36rpx;
    margin-left: 30rpx;
    border-bottom: 2rpx solid #d0d0d0;
  }

  .con {
    padding: 30rpx;
    background: #fff;
  }
</style>